<%--
  Created by IntelliJ IDEA.
  User: 许正雄
  Date: 2021/12/12
  Time: 20:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link type="text/css" rel="stylesheet" href="/static/css/style.css" />
    <script type="text/javascript" src="/static/scripts/function.js"></script>
    <script type="text/javascript" src="/static/jquery3.6.0.js"></script>
</head>
<body>
<div id="header" class="wrap">
    <div id="logo"><img src="http://localhost/images/qdn_log.jpg" style="width: 120px;height: 60px" /></div>
    <div style="width: 900px;height: 60px"><font color=#9A0F0A style="
                        width: 960px;
                        text-align: center;
                        height: 60px;
                        display: block;
                        line-height: 50px;
                        font-size: 22px;
                        font-weight: bold;
                        font-family: 微软雅黑;
                        padding-bottom: 20px;"
    >黔东南民族文化展示平台</font></div>
    <div class="navbar">
        <ul class="clearfix">
<%--            <li class="current"><a href="#">首页</a></li>--%>
<%--            <li><a href="#">图书</a></li>--%>
<%--            <li><a href="#">百货</a></li>--%>
<%--            <li><a href="#">品牌</a></li>--%>
<%--            <li><a href="#">促销</a></li>--%>
        </ul>
    </div>
</div>
<div id="childNav">
    <div class="wrap">
        <ul class="clearfix">
<%--            <li class="first"><a href="#">音乐</a></li>--%>
<%--            <li><a href="#">影视</a></li>--%>
<%--            <li><a href="#">少儿</a></li>--%>
<%--            <li><a href="#">动漫</a></li>--%>
<%--            <li><a href="#">小说</a></li>--%>
<%--            <li><a href="#">外语</a></li>--%>
<%--            <li><a href="#">数码相机</a></li>--%>
<%--            <li><a href="#">笔记本</a></li>--%>
<%--            <li><a href="#">羽绒服</a></li>--%>
<%--            <li><a href="#">秋冬靴</a></li>--%>
<%--            <li><a href="#">运动鞋</a></li>--%>
<%--            <li><a href="#">美容护肤</a></li>--%>
<%--            <li><a href="#">家纺用品</a></li>--%>
<%--            <li><a href="#">婴幼奶粉</a></li>--%>
<%--            <li><a href="#">饰品</a></li>--%>
<%--            <li class="last"><a href="#">Investor Relations</a></li>--%>
        </ul>
    </div>
</div>
<div id="register" class="wrap">
    <div class="shadow">
        <em class="corner lb"></em>
        <em class="corner rt"></em>
        <div class="box">
            <h1>欢迎注册</h1>
            <ul class="steps clearfix">
                <li class="current"><em></em>填写注册信息</li>
                <li class="last"><em></em></li>
            </ul>
            <form id="regForm" onsubmit="return checkForm(this);">
                <table>
                    <tr>
                        <td class="field">用户名：</td>
                        <td><input class="text" type="text" name="customerName"  id="customerName"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">登录密码：</td>
                        <td><input class="text" type="password" id="customerPwd" name="customerPwd"  /><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">姓名：</td>
                        <td><input class="text" type="text" id="customerNickName" name="customerNickName"  /><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">性别：</td>
                        <td>
                            <input type="radio" name="customerSex" value="0" />男&nbsp;&nbsp;&nbsp;&nbsp;
                            <input type="radio" name="customerSex" value="1" />女
                        </td>
                    </tr>
                    <tr>
                        <td class="field">年龄：</td>
                        <td><input class="text" type="text" id="customerAge" name="customerAge" /><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">手机号：</td>
                        <td><input class="text" type="text" id="customerPhone" name="customerPhone" /><span></span></td>
                    </tr>
<%--                    <tr>--%>
<%--                        <td class="field">住址：</td>--%>
<%--                        <td><input class="text" type="text" name="address" onfocus="FocusItem(this)" onblur="CheckItem(this);" /><span></span></td>--%>
<%--                    </tr>--%>
<%--                    <tr>--%>
<%--                        <td class="field">身份证号：</td>--%>
<%--                        <td><input class="text" type="text" name="idCard" onfocus="FocusItem(this)" onblur="CheckItem(this);" /><span></span></td>--%>
<%--                    </tr>--%>
                    <tr>
                        <td></td>
                        <td><label class="ui-green"><input id="sub" type="button" name="submit" value="提交注册" /></label></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
</div>
</body>
<script type="text/javascript">
$(function () {
    $("#customerName").blur(function () {
        $.ajax({
            url:"queryCustomerByUserName",
            type:"post",
            data:"customerName="+$(this).val(),
            success:function (ret) {
                if (ret*1===0){
                    alert("该用户名已被使用，请重新输入！！！");
                    window.location.href="register.jsp";
                }
            }
        })
    })
})
$(function () {
    $("#sub").click(function () {
        if ($("#customerName").val() == null || $("#customerName").val() == ''){
            alert("用户名不能为空！")
            return false
        }else if($("#customerPwd").val() == null || $("#customerPwd").val() == ''){
            alert("密码不能为空！")
            return false
        }else if($("#customerNickName").val() == null || $("#customerNickName").val() == ''){
            alert("姓名不能为空！")
            return false
        }else if($("#customerPhone").val() == null || $("#customerPhone").val() == ''){
            alert("手机号码不能为空！")
            return false
        }else {
            $.ajax({
                url:"registerCustomer",
                type: "post",
                data: $("#regForm").serialize(),
                success:function (ret) {
                    if (ret * 1 == 1){
                        alert("注册成功，即将为您跳转到登陆界面......")
                        window.location.href="login.jsp";
                    }else {
                        return false;
                    }
                }
            })
        }
    })
})

</script>
</html>
